//微信退款
exports.reimburse = function(req, res) {

	//获取restful参数
	var restfulParams = req.routeInfo.restfulParams;
	var bodyParams = req.routeInfo.bodyParams;

	//最终结果
	var resultData = {};

	//任务流创建
	async.waterfall([

		//退款
		function(cb) {

//			var signatureUrl = "http://"+config.publicConfig.SERVER_IP+"/WCHATPAY/wpay.php";
			var signatureUrl = "http://www.hxzbi.com:3200/WCHATPAY/wpay.php";//机构调用测试服客户端退款
//			var signatureUrl = "http://"+config.publicConfig.SERVER_IP + "/WCHATPAY/wpay.php";//机构调用测试服客户端退款
//			var signatureUrl = "http://www.artmofang.com/WCHATPAY/wpay.php";//机构调用正式服客户端退款

			R.SEND_HTTP(
				req, {
					url: signatureUrl,
					method: 'POST',
					data: {
						"action": "tuikuan",
						"transaction_id": bodyParams.transaction_id, //微信订单号
						"total_fee": bodyParams.total_fee, //总金额
						"refund_fee": bodyParams.refund_fee //退款金额
					}
				},
				function(err, data) {

					console.log('获取退款信息')
					console.log(data)

					if(err) {
						return RES.response(res, false, "退款失败");
					}

					resultData = data;

					cb();

				}
			);

		}

	], function(err, result) {

		//返回最终拼接结果
		RES.response(res, true, resultData);

	});

}